package com.tuozixuan.javafx.other;


import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.image.Image;
import javafx.stage.Stage;

public class ThreeFoldLineDemo extends Application {
	
    public static void main(String[] args) {
        launch(args);
    }

	@Override
	public void start(Stage primaryStage) throws Exception {
		
		ThreeFoldLine threeFoldLine = new ThreeFoldLine(101,201, 150, 100);
		ThreeFoldLine threeFoldLine2 = new ThreeFoldLine(101,201, 150, 150);
		ThreeFoldLine threeFoldLine3 = new ThreeFoldLine(101,201, 150, 200);
		ThreeFoldLine threeFoldLine4 = new ThreeFoldLine(101,201, 150, 250);
		ThreeFoldLine threeFoldLine5 = new ThreeFoldLine(101,201, 150, 300);
		
		Group root = new Group();
		root.getChildren().addAll(threeFoldLine.getGroup(), threeFoldLine2.getGroup()
				, threeFoldLine3.getGroup(), threeFoldLine4.getGroup(), threeFoldLine5.getGroup());
		
		
//		Line line = new Line();
//		line.setStartX(100);
//		line.setStartY(100);
//		line.setEndX(200);
//		line.setEndY(200);
//		
//		// True表示打开反锯齿，false表示关闭反锯齿。
//		line.setSmooth(true);
//		
//		
//		// 设置形状的笔划线的颜色
//		line.setStroke(Color.RED);
//		// 设置线的宽度
//		line.setStrokeWidth(2);
//		// 设置在Shape节点的边界周围绘制描边的位置
//		line.setStrokeType(StrokeType.INSIDE);
//		line.setStrokeType(StrokeType.OUTSIDE);
//		line.setStrokeType(StrokeType.CENTERED);
//		
//		// 在线或路径的末尾设置帽样式
//		line.setStrokeLineCap(StrokeLineCap.BUTT);
//		line.setStrokeLineCap(StrokeLineCap.ROUND);
//		line.setStrokeLineCap(StrokeLineCap.SQUARE);
//		
//		// 当线相遇时设置装饰
//		line.setStrokeLineJoin(StrokeLineJoin.MITER);
//		line.setStrokeLineJoin(StrokeLineJoin.ROUND);
//		line.setStrokeLineJoin(StrokeLineJoin.BEVEL);
//		
//		//line.getStrokeDashArray().addAll(15d, 5d, 15d, 15d, 20d);
//		line.getStrokeDashArray().addAll(2d, 2d, 2d, 2d, 2d);
//		line.setStrokeDashOffset(10);
//		
//		//line.setFill(Color.BLUE);
//		
//		// 设置当鼠标悬停在线条上时鼠标指针的显示
//		line.cursorProperty().set(Cursor.HAND);
		
        Scene scene = new Scene(root, 400, 400);

        // 设置左上角图标
        primaryStage.getIcons().add(new Image("see.png"));
        primaryStage.getIcons().addAll(new Image("see.png"), new Image("see.png"));
        
        // 设置标题
        primaryStage.setTitle("Welcome to JavaFX!");
        
        primaryStage.setScene(scene);
        primaryStage.sizeToScene();
        primaryStage.show();
        
        // 隐藏窗体
        primaryStage.hide();
        primaryStage.show();
        
        // 关闭窗口，相当于点击窗口关闭图标
        //primaryStage.close();
	}

}
